package health.lm.com.mine.adapter;

import android.annotation.SuppressLint;
import android.support.annotation.Nullable;

import com.blankj.utilcode.util.ConvertUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Locale;

import health.lm.com.mine.R;
import health.lm.com.mine.entity.RecordListBean;

/**
 *  提现明细
 */

public class RecordListAdapter extends BaseQuickAdapter<RecordListBean.Lists,BaseViewHolder> {
    public RecordListAdapter(@Nullable List<RecordListBean.Lists> data) {
        super( R.layout.item_record_list, data);
    }


    @Override
    protected void convert(BaseViewHolder helper, RecordListBean.Lists item) {
        @SuppressLint("SimpleDateFormat") SimpleDateFormat sdf = new SimpleDateFormat( );

        helper.setText(R.id.tv_name, getDate2String(item.getCreate_time(),"yyyy-MM-dd HH:mm:ss"))
                .setText(R.id.tv_money,String.format("￥%s", item.getMoney()));
//                .setText(R.id.tv_deal_time,item.getDate());
    }
    /**
     *
     * @param time  1541569323155
     * @param pattern yyyy-MM-dd HH:mm:ss
     * @return 2018-11-07 13:42:03
     */
    public static String getDate2String(long time, String pattern) {
        Date date = new Date(time*1000L);
        SimpleDateFormat format = new SimpleDateFormat(pattern, Locale.getDefault());
        return format.format(date);
    }
}
